﻿<r:RibbonWindow  x:Class="Wpfконфигуратор.Window1"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:r="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
        xmlns:this="clr-namespace:Wpfконфигуратор"
        xmlns:конфигуратор="clr-namespace:конфигуратор;assembly=конфигуратор" 
                 
        Title="Диспетчер"   Loaded="Window_Loaded"
        mc:Ignorable="d"
        d:DesignHeight="521" d:DesignWidth="871" Background="#FFDFE9F5">
    
    <Window.ContextMenu>
        <ContextMenu>
            <MenuItem Header="Window1"/>
        </ContextMenu>
    </Window.ContextMenu>
    
    
    <DockPanel  Name="stackPanelНижняя"      >

        <r:Ribbon DockPanel.Dock="Top" IsMinimized="True" IsDropDownOpen="False"></r:Ribbon>
        <TextBox FontSize="12" SpellCheck.IsEnabled="True"  DockPanel.Dock="Bottom" Name="textBox1"  Margin="3" 
                 Padding="3" TextWrapping="Wrap" AcceptsReturn="True" 
                 AutoWordSelection="True" MinLines="3" MaxLines="10" VerticalScrollBarVisibility="Auto" 
                 HorizontalScrollBarVisibility="Auto" />

        <Grid Name="grid1"   DockPanel.Dock="Top" >
            <Grid.Resources>
                <DataTemplate x:Key="паспорт" DataType="{x:Type конфигуратор:Паспорт}" >
                    <Border MouseMove="ListBoxItemDragMove" Background="White" Padding="3" Margin="1">
                        <Grid >
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>

                            <TextBlock  Text="{Binding Path=Имя, UpdateSourceTrigger=PropertyChanged}" />
                            <TextBlock Grid.Row="1"  Text="{Binding Path=Тип}" />
                            
                        </Grid>
                    </Border>
                </DataTemplate>
            </Grid.Resources>
            
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="161*" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="531*" />
            </Grid.ColumnDefinitions>
            
            <ListBox Name="ListBoxСписокОбъектов" MinWidth="100" HorizontalContentAlignment="Stretch"
                         ItemTemplate="{StaticResource ResourceKey=паспорт}"
                         AllowDrop="True"
                         SelectionChanged="СписокОбъектов_SelectionChanged" 
                        
                           Drop="ПаспортDropHandler" PreviewMouseRightButtonUp="ListBoxСписокОбъектов_PreviewMouseRightButtonUp" 
                     Background="WhiteSmoke">
                <ListBox.ItemContainerStyle>
                    <Style>
                        <Setter Property="ListBoxItem.Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="ListBoxItem" >
                                    <Border BorderThickness="3" Name="Bd" Background="OliveDrab">
                                        <ContentPresenter Content="{TemplateBinding ContentControl.Content}" ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}" HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
                                    </Border>
                                    <ControlTemplate.Triggers>
                                        <Trigger Property="Selector.IsSelected" Value="True">
                                            <Setter Property="Border.BorderBrush" TargetName="Bd" Value="Orange" />
                                        </Trigger>
                                        <MultiTrigger>
                                            <MultiTrigger.Conditions>
                                                <Condition Property="Selector.IsSelected" Value="True" />
                                            	<Condition Property="Selector.IsSelectionActive" Value="False" />
                                            </MultiTrigger.Conditions>
                                            <Setter Property="Border.BorderBrush" TargetName="Bd" Value="Orange" />
                                        </MultiTrigger>
                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </ListBox.ItemContainerStyle>
                
                <ListBox.CommandBindings>
                    <CommandBinding Command="Delete" Executed="CommandBinding_Executed_Удалить" CanExecute="CommandBinding_CanExecute_Удалить" />
                </ListBox.CommandBindings>
               
                <ListBox.ContextMenu>
                    <ContextMenu >
                        <MenuItem Header="Добавить">
                              <MenuItem Header="Создать новый объект ..."  Click="MenuItem_Click_Добавить" />
                              <MenuItem Header="Существующий объект ..."/>
                            </MenuItem>
                    	<MenuItem Header="Сохранить Объект"  />
                        <MenuItem Header="Восстановить Объект"  />
                        <Separator />
                        <MenuItem Header="Редактировать объект" Click="MenuItem_Click_Редактировать" />
                        <Separator />
                        <MenuItem Header="Копировать" Command="Copy" />
                        <MenuItem Header="Вставить" Command="Paste" />
                        <MenuItem Header="Удалить" Command="ApplicationCommands.Delete"  />
                        <Separator />
                        <MenuItem Header="Диспетчер"  >
                            <MenuItem Header="Сохранить "  />
                            <MenuItem Header="Восстановить"  />
                            <MenuItem Header="Отрыть другой"  />
                        </MenuItem>
                        
                        

                    </ContextMenu>
                </ListBox.ContextMenu>
            </ListBox>

            <GridSplitter Background="#FFDFE9F5" ShowsPreview="False"  HorizontalAlignment="Center"  Name="gridSplitter1"  Width="7" Grid.Column="1"  />
            <TabControl Grid.Column="2" >
                <TabItem Name="tabControlПаспорт" Header="паспорт">
                    <this:ПаспортВид  DataContext="{Binding ElementName=ListBoxСписокОбъектов, Path=SelectedItem}" Margin="10"/>
                </TabItem>
                
                <TabItem Header="Редактор">
                    <this:Редактор x:Name="Редактор1"  />
                </TabItem>

            </TabControl>
            
                
        </Grid>

    </DockPanel>
</r:RibbonWindow >
